.class public Lcom/burstly/lib/network/request/SingleHostRequest;
.super Lcom/burstly/lib/network/request/AbortableAsyncTask;
.source "SingleHostRequest.java"


# annotations
.annotation system Ldalvik/annotation/Signature;
    value = {
        "<T:",
        "Ljava/lang/Object;",
        ">",
        "Lcom/burstly/lib/network/request/AbortableAsyncTask",
        "<TT;>;"
    }
.end annotation


# static fields
.field private static final LOG:Lcom/burstly/lib/util/LoggerExt;


# instance fields
.field private mWorkerThread:Ljava/lang/Thread;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 38
    invoke-static {}, Lcom/burstly/lib/util/LoggerExt;->getInstance()Lcom/burstly/lib/util/LoggerExt;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/network/request/SingleHostRequest;->LOG:Lcom/burstly/lib/util/LoggerExt;

    return-void
.end method

.method public constructor <init>(Ljava/lang/String;Ljava/lang/String;)V
    .locals 0
    .parameter "remoteUrl"
    .parameter "burstlyViewId"

    .prologue
    .line 52
    .local p0, this:Lcom/burstly/lib/network/request/SingleHostRequest;,"Lcom/burstly/lib/network/request/SingleHostRequest<TT;>;"
    invoke-direct {p0, p1, p2}, Lcom/burstly/lib/network/request/AbortableAsyncTask;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    .line 53
    return-void
.end method


# virtual methods
.method public abortRequest()V
    .locals 1

    .prologue
    .line 62
    .local p0, this:Lcom/burstly/lib/network/request/SingleHostRequest;,"Lcom/burstly/lib/network/request/SingleHostRequest<TT;>;"
    invoke-super {p0}, Lcom/burstly/lib/network/request/AbortableAsyncTask;->abortRequest()V

    .line 63
    iget-object v0, p0, Lcom/burstly/lib/network/request/SingleHostRequest;->mWorkerThread:Ljava/lang/Thread;

    if-eqz v0, :cond_0

    .line 64
    iget-object v0, p0, Lcom/burstly/lib/network/request/SingleHostRequest;->mWorkerThread:Ljava/lang/Thread;

    invoke-virtual {v0}, Ljava/lang/Thread;->interrupt()V

    .line 66
    :cond_0
    return-void
.end method

.method protected convertServerResponse(Ljava/lang/String;)Ljava/lang/Object;
    .locals 1
    .parameter "response"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/lang/String;",
            ")TT;"
        }
    .end annotation

    .prologue
    .line 89
    .local p0, this:Lcom/burstly/lib/network/request/SingleHostRequest;,"Lcom/burstly/lib/network/request/SingleHostRequest<TT;>;"
    const/4 v0, 0x0

    return-object v0
.end method

.method protected getWorkerThread()Ljava/lang/Thread;
    .locals 1

    .prologue
    .line 98
    .local p0, this:Lcom/burstly/lib/network/request/SingleHostRequest;,"Lcom/burstly/lib/network/request/SingleHostRequest<TT;>;"
    iget-object v0, p0, Lcom/burstly/lib/network/request/SingleHostRequest;->mWorkerThread:Ljava/lang/Thread;

    return-object v0
.end method

.method protected makeRequest()Ljava/lang/String;
    .locals 13

    .prologue
    .local p0, this:Lcom/burstly/lib/network/request/SingleHostRequest;,"Lcom/burstly/lib/network/request/SingleHostRequest<TT;>;"
    const/4 v12, 0x0

    .line 70
    invoke-static {}, Lcom/burstly/lib/network/request/RequestManager;->isOnline()Z

    move-result v7

    if-eqz v7, :cond_0

    invoke-virtual {p0}, Lcom/burstly/lib/network/request/SingleHostRequest;->isAborted()Z

    move-result v7

    if-nez v7, :cond_0

    .line 71
    new-instance v7, Ljava/lang/StringBuilder;

    invoke-direct {v7}, Ljava/lang/StringBuilder;-><init>()V

    const-string v8, "SingleHostRequest of "

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {p0}, Lcom/burstly/lib/network/request/SingleHostRequest;->getBurstlyViewId()Ljava/lang/String;

    move-result-object v8

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    .line 72
    .local v5, tmpTag:Ljava/lang/String;
    invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;

    move-result-object v7

    iput-object v7, p0, Lcom/burstly/lib/network/request/SingleHostRequest;->mWorkerThread:Ljava/lang/Thread;

    .line 74
    :try_start_0
    invoke-virtual {p0}, Lcom/burstly/lib/network/request/SingleHostRequest;->getUri()Ljava/lang/String;

    move-result-object v6

    .line 75
    .local v6, uri:Ljava/lang/String;
    invoke-static {v6}, Lcom/burstly/lib/util/Utils;->makeGetRequest(Ljava/lang/String;)Lorg/apache/http/HttpResponse;

    move-result-object v3

    .line 76
    .local v3, response:Lorg/apache/http/HttpResponse;
    invoke-interface {v3}, Lorg/apache/http/HttpResponse;->getStatusLine()Lorg/apache/http/StatusLine;

    move-result-object v7

    invoke-interface {v7}, Lorg/apache/http/StatusLine;->getStatusCode()I

    move-result v4

    .line 77
    .local v4, statusCode:I
    invoke-interface {v3}, Lorg/apache/http/HttpResponse;->getEntity()Lorg/apache/http/HttpEntity;

    move-result-object v7

    invoke-interface {v7}, Lorg/apache/http/HttpEntity;->getContentLength()J

    move-result-wide v0

    .line 78
    .local v0, contentLength:J
    sget-object v7, Lcom/burstly/lib/network/request/SingleHostRequest;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v8, "Status code {0}, length {1}, url: {2}"

    const/4 v9, 0x3

    new-array v9, v9, [Ljava/lang/Object;

    const/4 v10, 0x0

    invoke-static {v4}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v11

    aput-object v11, v9, v10

    const/4 v10, 0x1

    invoke-static {v0, v1}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v11

    aput-object v11, v9, v10

    const/4 v10, 0x2

    aput-object v6, v9, v10

    invoke-virtual {v7, v5, v8, v9}, Lcom/burstly/lib/util/LoggerExt;->logDebug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 84
    .end local v0           #contentLength:J
    .end local v3           #response:Lorg/apache/http/HttpResponse;
    .end local v4           #statusCode:I
    .end local v5           #tmpTag:Ljava/lang/String;
    .end local v6           #uri:Ljava/lang/String;
    :cond_0
    :goto_0
    const/4 v7, 0x0

    return-object v7

    .line 80
    .restart local v5       #tmpTag:Ljava/lang/String;
    :catch_0
    move-exception v2

    .line 81
    .local v2, e:Ljava/lang/Exception;
    sget-object v7, Lcom/burstly/lib/network/request/SingleHostRequest;->LOG:Lcom/burstly/lib/util/LoggerExt;

    invoke-static {v2}, Landroid/util/Log;->getStackTraceString(Ljava/lang/Throwable;)Ljava/lang/String;

    move-result-object v8

    new-array v9, v12, [Ljava/lang/Object;

    invoke-virtual {v7, v5, v8, v9}, Lcom/burstly/lib/util/LoggerExt;->logWarning(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    goto :goto_0
.end method

.method protected setWorkerThread(Ljava/lang/Thread;)V
    .locals 0
    .parameter "workerThread"

    .prologue
    .line 107
    .local p0, this:Lcom/burstly/lib/network/request/SingleHostRequest;,"Lcom/burstly/lib/network/request/SingleHostRequest<TT;>;"
    iput-object p1, p0, Lcom/burstly/lib/network/request/SingleHostRequest;->mWorkerThread:Ljava/lang/Thread;

    .line 108
    return-void
.end method

.method protected tryToConnect(Lorg/apache/http/HttpHost;Lorg/apache/http/client/methods/HttpPost;)Ljava/lang/String;
    .locals 1
    .parameter "host"
    .parameter "post"

    .prologue
    .line 57
    .local p0, this:Lcom/burstly/lib/network/request/SingleHostRequest;,"Lcom/burstly/lib/network/request/SingleHostRequest<TT;>;"
    const/4 v0, 0x0

    return-object v0
.end method
